package com.moorror.codegenvel.common.tree.actions;

import com.moorror.codegenvel.common.tree.MTTreeCell;
import com.moorror.codegenvel.common.tree.TreePanelMark;
import com.moorror.codegenvel.utils.GuiUtils;
import org.jetbrains.annotations.Nullable;

import javax.swing.tree.DefaultMutableTreeNode;

/**
 * @Author jiyanghuang
 * @Date 2024/4/11 23:10
 */
public class SaveRightContentSqliteAllAction extends AbstractMTTreeCellSelectTreeAction{

    public SaveRightContentSqliteAllAction(TreePanelMark treePanelMark) {
        super("SaveRightContentSqlite", "保存右边配置到Sqlte", GuiUtils.S_SQLITE, treePanelMark);
    }

    public SaveRightContentSqliteAllAction(TreePanelMark treePanelMark,@Nullable String text, @Nullable String description) {
        super(text, description, GuiUtils.S_SQLITE, treePanelMark);
    }

    /**
     * 注意保存实现二选一
     * @param mutableTreeNode
     * @param mtTreeCell
     */
    @Override
    public void handleSelectTree(DefaultMutableTreeNode mutableTreeNode, MTTreeCell mtTreeCell) {
        mtTreeCell.saveRightContentSqlite(treePanelMark);
        mtTreeCell.saveRightContentSqlite(treePanelMark, mutableTreeNode);
    }
}
